﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Views.aspx.vb" Inherits="Macrography.Views" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <br /> 
        
        Search Images By Tags</p>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="Tags" 
                DataNavigateUrlFormatString="Tags.aspx?Tags={0}" DataTextField="Tags" 
                Text="Tags" />
        </Columns>
    </asp:GridView>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MacrgraphyConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:MacrgraphyConnectionString.ProviderName %>" 
        SelectCommand="SELECT DISTINCT [Images], [Tags] FROM [TagImageQuery]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="ListSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MacrgraphyConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:MacrgraphyConnectionString.ProviderName %>" 
        SelectCommand="SELECT [First_ Name] AS First_Name, [UserName], [Images], [Location], [Camera], [Cat_Name] FROM [ImageListView]">
    </asp:SqlDataSource>
    <p>
        View Images By ListView</p>
    <p>
        &nbsp;<asp:ListView ID="ListView1" runat="server" DataSourceID="ListSqlDataSource" 
            Visible="False">
            <AlternatingItemTemplate>
                <td runat="server" style="background-color: #FFFFFF;color: #284775;">
                    First_Name:
                    <asp:Label ID="First_NameLabel" runat="server" 
                        Text='<%# Eval("First_Name") %>' />
                    <br />
                    UserName:
                    <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                    <br />
                    Images:
                    <asp:Label ID="ImagesLabel" runat="server" Text='<%# Eval("Images") %>' />
                    <br />
                    Location:
                    <asp:Label ID="LocationLabel" runat="server" Text='<%# Eval("Location") %>' />
                    <br />
                    Camera:
                    <asp:Label ID="CameraLabel" runat="server" Text='<%# Eval("Camera") %>' />
                    <br />
                    Cat_Name:
                    <asp:Label ID="Cat_NameLabel" runat="server" Text='<%# Eval("Cat_Name") %>' />
                    <br />
                </td>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <td runat="server" style="background-color: #999999;">
                    First_Name:
                    <asp:TextBox ID="First_NameTextBox" runat="server" 
                        Text='<%# Bind("First_Name") %>' />
                    <br />
                    UserName:
                    <asp:TextBox ID="UserNameTextBox" runat="server" 
                        Text='<%# Bind("UserName") %>' />
                    <br />
                    Images:
                    <asp:TextBox ID="ImagesTextBox" runat="server" Text='<%# Bind("Images") %>' />
                    <br />
                    Location:
                    <asp:TextBox ID="LocationTextBox" runat="server" 
                        Text='<%# Bind("Location") %>' />
                    <br />
                    Camera:
                    <asp:TextBox ID="CameraTextBox" runat="server" Text='<%# Bind("Camera") %>' />
                    <br />
                    Cat_Name:
                    <asp:TextBox ID="Cat_NameTextBox" runat="server" 
                        Text='<%# Bind("Cat_Name") %>' />
                    <br />
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                </td>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <table style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <td runat="server" style="">
                    First_Name:
                    <asp:TextBox ID="First_NameTextBox" runat="server" 
                        Text='<%# Bind("First_Name") %>' />
                    <br />
                    UserName:
                    <asp:TextBox ID="UserNameTextBox" runat="server" 
                        Text='<%# Bind("UserName") %>' />
                    <br />
                    Images:
                    <asp:TextBox ID="ImagesTextBox" runat="server" Text='<%# Bind("Images") %>' />
                    <br />
                    Location:
                    <asp:TextBox ID="LocationTextBox" runat="server" 
                        Text='<%# Bind("Location") %>' />
                    <br />
                    Camera:
                    <asp:TextBox ID="CameraTextBox" runat="server" Text='<%# Bind("Camera") %>' />
                    <br />
                    Cat_Name:
                    <asp:TextBox ID="Cat_NameTextBox" runat="server" 
                        Text='<%# Bind("Cat_Name") %>' />
                    <br />
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                </td>
            </InsertItemTemplate>
            <ItemTemplate>
                <td runat="server" style="background-color: #E0FFFF;color: #333333;">
                    First_Name:
                    <asp:Label ID="First_NameLabel" runat="server" 
                        Text='<%# Eval("First_Name") %>' />
                    <br />
                    UserName:
                    <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                    <br />
                    Images:
                    <asp:Label ID="ImagesLabel" runat="server" Text='<%# Eval("Images") %>' />
                    <br />
                    Location:
                    <asp:Label ID="LocationLabel" runat="server" Text='<%# Eval("Location") %>' />
                    <br />
                    Camera:
                    <asp:Label ID="CameraLabel" runat="server" Text='<%# Eval("Camera") %>' />
                    <br />
                    Cat_Name:
                    <asp:Label ID="Cat_NameLabel" runat="server" Text='<%# Eval("Cat_Name") %>' />
                    <br />
                </td>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server" border="1" 
                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                    <tr ID="itemPlaceholderContainer" runat="server">
                        <td ID="itemPlaceholder" runat="server">
                        </td>
                    </tr>
                </table>
                <div style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">
                    <asp:DataPager ID="DataPager1" runat="server">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                ShowLastPageButton="True" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <td runat="server" 
                    style="background-color: #E2DED6;font-weight: bold;color: #333333;">
                    First_Name:
                    <asp:Label ID="First_NameLabel" runat="server" 
                        Text='<%# Eval("First_Name") %>' />
                    <br />
                    UserName:
                    <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                    <br />
                    Images:
                    <asp:Label ID="ImagesLabel" runat="server" Text='<%# Eval("Images") %>' />
                    <br />
                    Location:
                    <asp:Label ID="LocationLabel" runat="server" Text='<%# Eval("Location") %>' />
                    <br />
                    Camera:
                    <asp:Label ID="CameraLabel" runat="server" Text='<%# Eval("Camera") %>' />
                    <br />
                    Cat_Name:
                    <asp:Label ID="Cat_NameLabel" runat="server" Text='<%# Eval("Cat_Name") %>' />
                    <br />
                </td>
            </SelectedItemTemplate>
        </asp:ListView>
    </p>
    <asp:Button ID="ListBtn" runat="server" Text="ListView" />
    <p>
        Average Rating By Images</p>
    <asp:Button ID="AvgRatBtn" runat="server" Text="Show Average Rating" />
    <p>
        &nbsp;<asp:GridView ID="AvgGrid" runat="server" AutoGenerateColumns="False" 
            DataSourceID="RatingDataSource" Visible="False">
            <Columns>
                <asp:ImageField DataImageUrlField="Images" HeaderText="Image">
                    <ControlStyle Height="100px" Width="100px" />
                </asp:ImageField>
                <asp:BoundField DataField="AverageRating" HeaderText="AverageRating" 
                    ReadOnly="True" SortExpression="AverageRating" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="RatingDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MacrgraphyConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:MacrgraphyConnectionString.ProviderName %>" 
            SelectCommand="SELECT [Images], [AverageRating] FROM [AvgRatingByImage]">
        </asp:SqlDataSource>
       
    </p>
    <p>
        Chart View Of Rating</p>
    <p>
        <asp:Button ID="GraphBtn" runat="server" Text="Graph" />
       
    </p>
    <p>
        <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource2" 
            Visible="False">
            <series>
                <asp:Series Name="Series1" XValueMember="Images" YValueMembers="AverageRating">
                </asp:Series>
            </series>
            <chartareas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </chartareas>
        </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MacrgraphyConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:MacrgraphyConnectionString.ProviderName %>" 
            SelectCommand="SELECT [Images], [AverageRating] FROM [AvgRatingByImage]">
        </asp:SqlDataSource>
       
    </p>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
   
    <p>
        &nbsp;</p>
   
   
   
   
</asp:Content>
